Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

XenServer Machinery #434

Merged
merged 15 commits into from
Feb 13, 2015
Merged

XenServer Machinery #434

merged 15 commits into from
Feb 13, 2015

Conversation

ameily
Copy link
Contributor

@ameily ameily commented Jan 8, 2015

This merge request implements the XenServer machinery. The machinery communicates to a XenServer instance through the XenAPI library, which uses an HTTP(S) XML RPC interface. The machinery supports the following functions:

  • Starting and stopping VMs: start() and stop()
  • Checking the power state of a VM: _status()
  • Listing available VMs: list()
  • Reverting a VM to a previous state

The XenServer machinery supports two methods of VM restoration:

  • Memory and disk snapshots
  • Disk resetting on boot

Memory and disk snapshots require that the VM has the Xen guest tools installed, which may not be possible in some environments. Therefore, the machinery also supports launching VMs that have their disks reset on boot, which is configured on a per VM basis in the XenServer instance.

The documentation has also been updated to include XenServer related configuration and usage.

@GelosSnake
Copy link

Great work! specially since newer versions of esxi (free) don't have API.

@botherder
Copy link
Member

It looks good to me, but it would be good to have some proper testing. For significant contributions, please also remember to check out this http://cuckoofoundation.org/contribute.

@ameily
Copy link
Contributor Author

ameily commented Jan 9, 2015

Signing the agreement shouldn't be problem. I'll take a look at it tomorrow.

As far as testing, I tested the machinery against a XenServer instance that I already had running with multiple VMs and different configurations. Beyond that, are you looking for anything formal?

@botherder
Copy link
Member

No, not formal, but it's generally good to have feedback from other users so that they can verify the setup and configuration procedures as well as perhaps reveal issues that only different installations might raise.

@ghost
Copy link

ghost commented Jan 28, 2015

ameily:
I spun this up on my i7 box. Here's my notes:

o The documentation doesn't mention installing xenapi. Gave me an error - 'pip install xenapi' fixed it
o The configuration section was confusing. I entered machine=xen and wondered why it was failing (machine=xenserver for those wondering)
o When choosing to use VM disk resetting (Boot from disk section), it should mention that the VM must be shut down before executing the commands on XenServer
o Maybe it was the machine I had running XenServer, but suspending, resuming, restarting, and ejecting disks from the vm through XenCenter was sluggish (~1 minute for each command)
o There were times when the cuckoo job would hang and cuckoo.py had to be restarted to resume. Probably a cuckoo thing and not a Xen thing

The XenAPI XMLRPC connection is not thread safe.
I modified the machinery to store a single XenAPI connection in each thread.
Creating the connection is done on the fly and on demand; a new connection is
created when a thread uses the machinery for the first time.
@ameily
Copy link
Contributor Author

ameily commented Jan 29, 2015

Thanks for the feedback @wealthychef! I've clarified spots of my documentation that you pointed out. Specifically, I modifed the Installation Preparing the Host -> Requirements and Preparing the Guest -> Saving the Virtual Machine -> Booting from Disk sections. Could you please review it and make sure it good to go?

Also, I'd like to confirm that the hanging issue you are seeing is not the XenServer machinery. I tested the machinery locally again and found that the XenAPI is not thread safe. I've fixed this limitation with my recent commits. My guess is that you were either seeing this issue or you did not specify a runtime timeout for the samples. Can you please retest and verify that the issue is not with the XenServer machinery?

@ghost
Copy link

ghost commented Jan 29, 2015

I checked out the documentation and it looks like the ambiguities were addressed. I also re-ran my previous tests to attempt to get cuckoo to 'hang', but it ran smoothly through everything I threw at it. Thanks for the quick response!

@botherder
Copy link
Member

Unless @jekil has some issues with it, I'm ok for merging.

@jekil
Copy link
Member

jekil commented Feb 8, 2015

@botherder ok for me

botherder added a commit that referenced this pull request Feb 13, 2015
@botherder botherder merged commit 9bfca6b into cuckoosandbox:master Feb 13, 2015
@jekil
Copy link
Member

jekil commented Feb 13, 2015

@ameily thanks a lot for this contribution, it is really high-quality code.

jekil added a commit that referenced this pull request Feb 13, 2015
jekil added a commit that referenced this pull request Feb 13, 2015
@alexandrafengfei
Copy link

Hi. Now I am using Ubuntu with Xen hypervisor. Could I use the XenServer machinery? Or how could II modify it? The xen hypervisor does not have a XenServer URL.

@ameily
Copy link
Contributor Author

ameily commented May 9, 2016

The stock Xen hypervisor is not compatible with the XenServer machinery. However, you should be able to use the libvirt machinery.

@alexandrafengfei
Copy link

Thank you! Just to be sure, I should modify the machinery=xen in the cuckoo.conf, right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants